package com.mywife.comtroller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.text.SimpleDateFormat;
import java.util.Date;

@RestController(value = "/")
public class WebController {

    private final Logger logger = LoggerFactory.getLogger(WebController.class);

    @RequestMapping(value = "", method = RequestMethod.GET)
    public ModelAndView toIndex() {

        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        for (int i = 0; i < 10; i++) {
            logger.info(format.format(new Date()));
        }

        ModelAndView modelAndView = new ModelAndView("index");
        return modelAndView;
    }
}
